﻿using System;

using X = Microsoft.Xna.Framework;

namespace XNA.BLEND.parser {
  internal class ActionKeyframe {
    internal X.Matrix Matrix {
      get {
        X.Matrix result = X.Matrix.Identity;

        if ( this.Scale != null ) {
          result *= X.Matrix.CreateScale( this.Scale[0], this.Scale[1], this.Scale[2] );
        }

        if ( this.Rotation != null ) {
          result = X.Matrix.Transform( result, new X.Quaternion( this.Rotation[1], this.Rotation[2], this.Rotation[3], this.Rotation[0] ) );         
        }

        if ( this.Location != null ) {
          result *= X.Matrix.CreateTranslation( this.Location[0], this.Location[1], this.Location[2] );
        }

        return result;
      }
    }

    internal float[] Location { get; set; }
    internal float[] Rotation { get; set; }
    internal float[] Scale { get; set; }
  }
}
